unit CfopMaisDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, MainDM,QueryConditions, db;

type

  { TCfopMaisData }

  TCfopMaisData = class(TMainDataModule)
    CfopMaisDatasource: TDatasource;
    CfopMaisZQuerycode: TStringField;
    CfopMaisZQuerydesc_cfop: TStringField;
    CfopMaisZUpdate: TZUpdateSQL;
    CfopMaisZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  CfopMaisData: TCfopMaisData;

implementation
uses ConnectionDM;

procedure TCfopMaisData.DataModuleCreate(Sender: TObject);
begin
  MainDataSet := CfopMaisZQuery;
  CfopMaisZQuery.Open;
end;

procedure TCfopMaisData.OpenDataSet;
begin
    // ConnectionData.EmptyQuery(CfopMaisZQuery, 'cfop');
end;

procedure TCfopMaisData.CloseDataSet;
begin
  // CfopMaisZQuery.Close();
end;

procedure TCfopMaisData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
   ConnectionData.OpenQueryConditions(CfopMaisZQuery, Tabela, Condicoes);
end;


initialization
  {$I cfopmaisdm.lrs}

end.

